/**
 * Created by machan on 2017/4/20.
 */
import * as umfUtils from './UmfUtils';

class DeviceUtils {
    isIos() {
        return this.getSystemType() === 'ios';
    }

    /**
     * 获取终端Id
     * @returns {string}
     */
    getTerminalid() {
        let array = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
        let rd4 = umfUtils.getRandom(array, 4);
        return "ZZZ" + rd4;
    }

    getSystemType() {
        const app = getApp();
        let system = app.globalData.systemInfo.system;
        if (system.startsWith('Android')) {
            return 'android';
        } else if (system.startsWith('iOS')) {
            return 'ios';
        }
    }
}

DeviceUtils = new DeviceUtils();
module.exports = DeviceUtils;